﻿
using ORM.GraphQL.Model;
using System.Linq;
 
 
namespace ORM.GraphQL.Model
{
    public class Query
    {
        private List<Student> GetStudents()
        {
            List<Student> students = new List<Student>();
            students.Add(new Student
            {
                Realname = "ZHANGSAN",
                Class = new Class
                {
                    Name = "GAOSAN",
                    Teacher = new Teacher { Realname = "LISI", IsSupervisor = false }
                }
            });
            students.Add(new Student
            {
                Realname = "ZHANGSAN2",
                Class = new Class
                {
                    Name = "GAOSAN1",
                    Teacher = new Teacher { Realname = "LISI", IsSupervisor = true }
                }
            });
            return students;
        }
        public IEnumerable<Student> StudentInfo(string name)
        {
            if (string.IsNullOrWhiteSpace(name)) return GetStudents();
            return GetStudents().Where(w => w.Realname == name);
        }
    }
}